<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: Network buffers</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__netbuf.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Network buffers<div class="ingroups"><a class="el" href="group__api.html">APIs</a> &raquo; <a class="el" href="group__sequential__api.html">Sequential-style APIs</a> &raquo; <a class="el" href="group__netconn.html">Netconn API</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaaba704cd963e35e71145de9f5112991d"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#gaaba704cd963e35e71145de9f5112991d">netbuf_new</a> (void)</td></tr>
<tr class="separator:gaaba704cd963e35e71145de9f5112991d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9dfd3ddfe0ec65009cb140c68404b09d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga9dfd3ddfe0ec65009cb140c68404b09d">netbuf_delete</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf)</td></tr>
<tr class="separator:ga9dfd3ddfe0ec65009cb140c68404b09d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0b831b80d3aa64938abdbfb6d89eaac0"><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga0b831b80d3aa64938abdbfb6d89eaac0">netbuf_alloc</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf, u16_t size)</td></tr>
<tr class="separator:ga0b831b80d3aa64938abdbfb6d89eaac0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga02f82348ac23431a4b1512feae25f26b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga02f82348ac23431a4b1512feae25f26b">netbuf_free</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf)</td></tr>
<tr class="separator:ga02f82348ac23431a4b1512feae25f26b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabdffa0401e4473c9d9100ecbf50e46d2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#gabdffa0401e4473c9d9100ecbf50e46d2">netbuf_ref</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf, const void *dataptr, u16_t size)</td></tr>
<tr class="separator:gabdffa0401e4473c9d9100ecbf50e46d2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga631e8bddd99b2397cd0b26973c659602"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga631e8bddd99b2397cd0b26973c659602">netbuf_chain</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *head, struct <a class="el" href="structnetbuf.html">netbuf</a> *tail)</td></tr>
<tr class="separator:ga631e8bddd99b2397cd0b26973c659602"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga04a54a8476b37c2a8804fed679b6cc01"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga04a54a8476b37c2a8804fed679b6cc01">netbuf_data</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf, void **dataptr, u16_t *len)</td></tr>
<tr class="separator:ga04a54a8476b37c2a8804fed679b6cc01"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf4e3718d378bb11f2fc8af42ce7b3715"><td class="memItemLeft" align="right" valign="top">s8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#gaf4e3718d378bb11f2fc8af42ce7b3715">netbuf_next</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf)</td></tr>
<tr class="separator:gaf4e3718d378bb11f2fc8af42ce7b3715"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga222ad2a2eb871d603b216a87e9f9be51"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netbuf.html#ga222ad2a2eb871d603b216a87e9f9be51">netbuf_first</a> (struct <a class="el" href="structnetbuf.html">netbuf</a> *buf)</td></tr>
<tr class="separator:ga222ad2a2eb871d603b216a87e9f9be51"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Network buffer descriptor for <a class="el" href="group__netconn.html">Netconn API</a>. Based on <a class="el" href="group__pbuf.html">Packet buffers (PBUF)</a> internally to avoid copying data around.<br />
Buffers must not be shared accross multiple threads, all functions except <a class="el" href="group__netbuf.html#gaaba704cd963e35e71145de9f5112991d">netbuf_new()</a> and <a class="el" href="group__netbuf.html#ga9dfd3ddfe0ec65009cb140c68404b09d">netbuf_delete()</a> are not thread-safe. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga0b831b80d3aa64938abdbfb6d89eaac0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0b831b80d3aa64938abdbfb6d89eaac0">&#9670;&nbsp;</a></span>netbuf_alloc()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* netbuf_alloc </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Allocate memory for a packet buffer for a given netbuf.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>the netbuf for which to allocate a packet buffer </td></tr>
    <tr><td class="paramname">size</td><td>the size of the packet buffer to allocate </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>pointer to the allocated memory NULL if no memory could be allocated </dd></dl>

</div>
</div>
<a id="ga631e8bddd99b2397cd0b26973c659602"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga631e8bddd99b2397cd0b26973c659602">&#9670;&nbsp;</a></span>netbuf_chain()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void netbuf_chain </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>head</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>tail</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Chain one netbuf to another (</p><dl class="section see"><dt>See also</dt><dd><a class="el" href="group__pbuf.html#ga831c9a72bda1d3bd4c7b96f5a0e3b891">pbuf_chain</a>)</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">head</td><td>the first netbuf </td></tr>
    <tr><td class="paramname">tail</td><td>netbuf to chain after head, freed by this function, may not be reference after returning </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga04a54a8476b37c2a8804fed679b6cc01"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga04a54a8476b37c2a8804fed679b6cc01">&#9670;&nbsp;</a></span>netbuf_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> netbuf_data </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>dataptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16_t *&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the data pointer and length of the data inside a netbuf.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>netbuf to get the data from </td></tr>
    <tr><td class="paramname">dataptr</td><td>pointer to a void pointer where to store the data pointer </td></tr>
    <tr><td class="paramname">len</td><td>pointer to an u16_t where the length of the data is stored </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK if the information was retrieved, ERR_BUF on error. </dd></dl>

</div>
</div>
<a id="ga9dfd3ddfe0ec65009cb140c68404b09d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9dfd3ddfe0ec65009cb140c68404b09d">&#9670;&nbsp;</a></span>netbuf_delete()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void netbuf_delete </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Deallocate a netbuf allocated by <a class="el" href="group__netbuf.html#gaaba704cd963e35e71145de9f5112991d">netbuf_new()</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to a netbuf allocated by <a class="el" href="group__netbuf.html#gaaba704cd963e35e71145de9f5112991d">netbuf_new()</a> </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga222ad2a2eb871d603b216a87e9f9be51"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga222ad2a2eb871d603b216a87e9f9be51">&#9670;&nbsp;</a></span>netbuf_first()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void netbuf_first </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Move the current data pointer of a packet buffer contained in a netbuf to the beginning of the packet. The packet buffer itself is not modified.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>the netbuf to modify </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga02f82348ac23431a4b1512feae25f26b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga02f82348ac23431a4b1512feae25f26b">&#9670;&nbsp;</a></span>netbuf_free()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void netbuf_free </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Free the packet buffer included in a netbuf</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>pointer to the netbuf which contains the packet buffer to free </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaaba704cd963e35e71145de9f5112991d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaaba704cd963e35e71145de9f5112991d">&#9670;&nbsp;</a></span>netbuf_new()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structnetbuf.html">netbuf</a>* netbuf_new </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Create (allocate) and initialize a new netbuf. The netbuf doesn't yet contain a packet buffer!</p>
<dl class="section return"><dt>Returns</dt><dd>a pointer to a new netbuf NULL on lack of memory </dd></dl>

</div>
</div>
<a id="gaf4e3718d378bb11f2fc8af42ce7b3715"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf4e3718d378bb11f2fc8af42ce7b3715">&#9670;&nbsp;</a></span>netbuf_next()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">s8_t netbuf_next </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Move the current data pointer of a packet buffer contained in a netbuf to the next part. The packet buffer itself is not modified.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>the netbuf to modify </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-1 if there is no next part 1 if moved to the next part but now there is no next part 0 if moved to the next part and there are still more parts </dd></dl>

</div>
</div>
<a id="gabdffa0401e4473c9d9100ecbf50e46d2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gabdffa0401e4473c9d9100ecbf50e46d2">&#9670;&nbsp;</a></span>netbuf_ref()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__infrastructure__errors.html#gaf02d9da80fd66b4f986d2c53d7231ddb">err_t</a> netbuf_ref </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structnetbuf.html">netbuf</a> *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>dataptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16_t&#160;</td>
          <td class="paramname"><em>size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Let a netbuf reference existing (non-volatile) data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">buf</td><td>netbuf which should reference the data </td></tr>
    <tr><td class="paramname">dataptr</td><td>pointer to the data to reference </td></tr>
    <tr><td class="paramname">size</td><td>size of the data </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ERR_OK if data is referenced ERR_MEM if data couldn't be referenced due to lack of memory </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
